//
//  HotImgViewModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/7.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "HotImgViewModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface HotImgViewModelCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imgsrcView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *sourceLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyCountLabel;


@end
@implementation HotImgViewModelCell

-(void)setModel:(HotImgViewModel *)model {
    if (_model != model) {
        _model = model;
    }
}
- (void)layoutSubviews {
    [self.imgsrcView sd_setImageWithURL:[NSURL URLWithString:self.model.img]];
    self.titleLabel.text = self.model.title;
    self.sourceLabel.text = self.model.source;
    self.replyCountLabel.text = [NSString stringWithFormat:@"%@跟帖",self.model.replyCount];
    self.imgsrcView.userInteractionEnabled = YES;
    UITapGestureRecognizer *singleTap =
    [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageAction:)];
    [self.imgsrcView addGestureRecognizer:singleTap];
    
}
- (void)bigImageAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.imgsrcView];
    
}
+ (CGFloat)height {
    return 150;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
